//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS Account service.
///
/// Operations for Amazon Web Services Account Management
public struct Account: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the Account client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: nil,
            partition: partition,
            serviceName: "Account",
            serviceIdentifier: "account",
            serviceProtocol: .restjson,
            apiVersion: "2021-02-01",
            endpoint: endpoint,
            serviceEndpoints: Self.serviceEndpoints,
            partitionEndpoints: Self.partitionEndpoints,
            errorType: AccountErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }


    /// custom endpoints for regions
    static var serviceEndpoints: [String: String] {[
        "aws-cn-global": "account.cn-northwest-1.amazonaws.com.cn",
        "aws-global": "account.us-east-1.amazonaws.com"
    ]}

    /// Default endpoint and region to use for each partition
    static var partitionEndpoints: [AWSPartition: (endpoint: String, region: SotoCore.Region)] {[
        .aws: (endpoint: "aws-global", region: .useast1),
        .awscn: (endpoint: "aws-cn-global", region: .cnnorthwest1)
    ]}


    // MARK: API Calls

    /// Accepts the request that originated from StartPrimaryEmailUpdate to update the primary email address (also known as the root user email address) for the specified account.
    @Sendable
    @inlinable
    public func acceptPrimaryEmailUpdate(_ input: AcceptPrimaryEmailUpdateRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> AcceptPrimaryEmailUpdateResponse {
        try await self.client.execute(
            operation: "AcceptPrimaryEmailUpdate", 
            path: "/acceptPrimaryEmailUpdate", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Accepts the request that originated from StartPrimaryEmailUpdate to update the primary email address (also known as the root user email address) for the specified account.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
    ///   - otp: The OTP code sent to the PrimaryEmail specified on the StartPrimaryEmailUpdate API call.
    ///   - primaryEmail: The new primary email address for use with the specified account. This must match the PrimaryEmail from the StartPrimaryEmailUpdate API call.
    ///   - logger: Logger use during operation
    @inlinable
    public func acceptPrimaryEmailUpdate(
        accountId: String,
        otp: String,
        primaryEmail: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> AcceptPrimaryEmailUpdateResponse {
        let input = AcceptPrimaryEmailUpdateRequest(
            accountId: accountId, 
            otp: otp, 
            primaryEmail: primaryEmail
        )
        return try await self.acceptPrimaryEmailUpdate(input, logger: logger)
    }

    /// Deletes the specified alternate contact from an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    @Sendable
    @inlinable
    public func deleteAlternateContact(_ input: DeleteAlternateContactRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteAlternateContact", 
            path: "/deleteAlternateContact", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes the specified alternate contact from an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - alternateContactType: Specifies which of the alternate contacts to delete.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteAlternateContact(
        accountId: String? = nil,
        alternateContactType: AlternateContactType,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteAlternateContactRequest(
            accountId: accountId, 
            alternateContactType: alternateContactType
        )
        return try await self.deleteAlternateContact(input, logger: logger)
    }

    /// Disables (opts-out) a particular Region for an account.  The act of disabling a Region will remove all IAM access to any resources that reside in that Region.
    @Sendable
    @inlinable
    public func disableRegion(_ input: DisableRegionRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DisableRegion", 
            path: "/disableRegion", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Disables (opts-out) a particular Region for an account.  The act of disabling a Region will remove all IAM access to any resources that reside in that Region.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - regionName: Specifies the Region-code for a given Region name (for example, af-south-1). When you disable a Region, Amazon Web Services performs actions to deactivate that Region in your account, such as destroying IAM resources in the Region. This process takes a few minutes for most accounts, but this can take several hours. You cannot enable the Region until the disabling process is fully completed.
    ///   - logger: Logger use during operation
    @inlinable
    public func disableRegion(
        accountId: String? = nil,
        regionName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DisableRegionRequest(
            accountId: accountId, 
            regionName: regionName
        )
        return try await self.disableRegion(input, logger: logger)
    }

    /// Enables (opts-in) a particular Region for an account.
    @Sendable
    @inlinable
    public func enableRegion(_ input: EnableRegionRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "EnableRegion", 
            path: "/enableRegion", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Enables (opts-in) a particular Region for an account.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - regionName: Specifies the Region-code for a given Region name (for example, af-south-1). When you enable a Region, Amazon Web Services performs actions to prepare your account in that Region, such as distributing your IAM resources to the Region. This process takes a few minutes for most accounts, but it can take several hours. You cannot use the Region until this process is complete. Furthermore, you cannot disable the Region until the enabling process is fully completed.
    ///   - logger: Logger use during operation
    @inlinable
    public func enableRegion(
        accountId: String? = nil,
        regionName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = EnableRegionRequest(
            accountId: accountId, 
            regionName: regionName
        )
        return try await self.enableRegion(input, logger: logger)
    }

    /// Retrieves information about the specified account including its account name, account ID, and account creation date and time. To use this API, an IAM user or role must have the account:GetAccountInformation IAM permission.
    @Sendable
    @inlinable
    public func getAccountInformation(_ input: GetAccountInformationRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetAccountInformationResponse {
        try await self.client.execute(
            operation: "GetAccountInformation", 
            path: "/getAccountInformation", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves information about the specified account including its account name, account ID, and account creation date and time. To use this API, an IAM user or role must have the account:GetAccountInformation IAM permission.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - logger: Logger use during operation
    @inlinable
    public func getAccountInformation(
        accountId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetAccountInformationResponse {
        let input = GetAccountInformationRequest(
            accountId: accountId
        )
        return try await self.getAccountInformation(input, logger: logger)
    }

    /// Retrieves the specified alternate contact attached to an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    @Sendable
    @inlinable
    public func getAlternateContact(_ input: GetAlternateContactRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetAlternateContactResponse {
        try await self.client.execute(
            operation: "GetAlternateContact", 
            path: "/getAlternateContact", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the specified alternate contact attached to an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - alternateContactType: Specifies which alternate contact you want to retrieve.
    ///   - logger: Logger use during operation
    @inlinable
    public func getAlternateContact(
        accountId: String? = nil,
        alternateContactType: AlternateContactType,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetAlternateContactResponse {
        let input = GetAlternateContactRequest(
            accountId: accountId, 
            alternateContactType: alternateContactType
        )
        return try await self.getAlternateContact(input, logger: logger)
    }

    /// Retrieves the primary contact information of an Amazon Web Services account. For complete details about how to use the primary contact operations, see Update the primary and alternate contact information.
    @Sendable
    @inlinable
    public func getContactInformation(_ input: GetContactInformationRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetContactInformationResponse {
        try await self.client.execute(
            operation: "GetContactInformation", 
            path: "/getContactInformation", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the primary contact information of an Amazon Web Services account. For complete details about how to use the primary contact operations, see Update the primary and alternate contact information.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - logger: Logger use during operation
    @inlinable
    public func getContactInformation(
        accountId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetContactInformationResponse {
        let input = GetContactInformationRequest(
            accountId: accountId
        )
        return try await self.getContactInformation(input, logger: logger)
    }

    /// Retrieves the primary email address for the specified account.
    @Sendable
    @inlinable
    public func getPrimaryEmail(_ input: GetPrimaryEmailRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetPrimaryEmailResponse {
        try await self.client.execute(
            operation: "GetPrimaryEmail", 
            path: "/getPrimaryEmail", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the primary email address for the specified account.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
    ///   - logger: Logger use during operation
    @inlinable
    public func getPrimaryEmail(
        accountId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetPrimaryEmailResponse {
        let input = GetPrimaryEmailRequest(
            accountId: accountId
        )
        return try await self.getPrimaryEmail(input, logger: logger)
    }

    /// Retrieves the opt-in status of a particular Region.
    @Sendable
    @inlinable
    public func getRegionOptStatus(_ input: GetRegionOptStatusRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetRegionOptStatusResponse {
        try await self.client.execute(
            operation: "GetRegionOptStatus", 
            path: "/getRegionOptStatus", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the opt-in status of a particular Region.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - regionName: Specifies the Region-code for a given Region name (for example, af-south-1). This function will return the status of whatever Region you pass into this parameter.
    ///   - logger: Logger use during operation
    @inlinable
    public func getRegionOptStatus(
        accountId: String? = nil,
        regionName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetRegionOptStatusResponse {
        let input = GetRegionOptStatusRequest(
            accountId: accountId, 
            regionName: regionName
        )
        return try await self.getRegionOptStatus(input, logger: logger)
    }

    /// Lists all the Regions for a given account and their respective opt-in statuses. Optionally, this list can be filtered by the region-opt-status-contains parameter.
    @Sendable
    @inlinable
    public func listRegions(_ input: ListRegionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListRegionsResponse {
        try await self.client.execute(
            operation: "ListRegions", 
            path: "/listRegions", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all the Regions for a given account and their respective opt-in statuses. Optionally, this list can be filtered by the region-opt-status-contains parameter.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - maxResults: The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a NextToken is provided in the command’s output. To resume pagination, provide the NextToken value in the starting-token argument of a subsequent command. Do not use the NextToken response element directly outside of the Amazon Web Services CLI. For usage examples, see Pagination in the Amazon Web Services Command Line Interface User Guide.
    ///   - nextToken: A token used to specify where to start paginating. This is the NextToken from a previously truncated response. For usage examples, see Pagination in the Amazon Web Services Command Line Interface User Guide.
    ///   - regionOptStatusContains: A list of Region statuses (Enabling, Enabled, Disabling, Disabled, Enabled_by_default) to use to filter the list of Regions for a given account. For example, passing in a value of ENABLING will only return a list of Regions with a Region status of ENABLING.
    ///   - logger: Logger use during operation
    @inlinable
    public func listRegions(
        accountId: String? = nil,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        regionOptStatusContains: [RegionOptStatus]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListRegionsResponse {
        let input = ListRegionsRequest(
            accountId: accountId, 
            maxResults: maxResults, 
            nextToken: nextToken, 
            regionOptStatusContains: regionOptStatusContains
        )
        return try await self.listRegions(input, logger: logger)
    }

    /// Updates the account name of the specified account. To use this API, IAM principals must have the account:PutAccountName IAM permission.
    @Sendable
    @inlinable
    public func putAccountName(_ input: PutAccountNameRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "PutAccountName", 
            path: "/putAccountName", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the account name of the specified account. To use this API, IAM principals must have the account:PutAccountName IAM permission.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - accountName: The name of the account.
    ///   - logger: Logger use during operation
    @inlinable
    public func putAccountName(
        accountId: String? = nil,
        accountName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = PutAccountNameRequest(
            accountId: accountId, 
            accountName: accountName
        )
        return try await self.putAccountName(input, logger: logger)
    }

    /// Modifies the specified alternate contact attached to an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    @Sendable
    @inlinable
    public func putAlternateContact(_ input: PutAlternateContactRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "PutAlternateContact", 
            path: "/putAlternateContact", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Modifies the specified alternate contact attached to an Amazon Web Services account. For complete details about how to use the alternate contact operations, see Access or updating the alternate contacts.  Before you can update the alternate contact information for an Amazon Web Services account that is managed by Organizations, you must first enable integration between Amazon Web Services Account Management and Organizations. For more information, see Enabling trusted access for Amazon Web Services Account Management.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - alternateContactType: Specifies which alternate contact you want to create or update.
    ///   - emailAddress: Specifies an email address for the alternate contact.
    ///   - name: Specifies a name for the alternate contact.
    ///   - phoneNumber: Specifies a phone number for the alternate contact.
    ///   - title: Specifies a title for the alternate contact.
    ///   - logger: Logger use during operation
    @inlinable
    public func putAlternateContact(
        accountId: String? = nil,
        alternateContactType: AlternateContactType,
        emailAddress: String,
        name: String,
        phoneNumber: String,
        title: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = PutAlternateContactRequest(
            accountId: accountId, 
            alternateContactType: alternateContactType, 
            emailAddress: emailAddress, 
            name: name, 
            phoneNumber: phoneNumber, 
            title: title
        )
        return try await self.putAlternateContact(input, logger: logger)
    }

    /// Updates the primary contact information of an Amazon Web Services account. For complete details about how to use the primary contact operations, see Update the primary and alternate contact information.
    @Sendable
    @inlinable
    public func putContactInformation(_ input: PutContactInformationRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "PutContactInformation", 
            path: "/putContactInformation", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the primary contact information of an Amazon Web Services account. For complete details about how to use the primary contact operations, see Update the primary and alternate contact information.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - contactInformation: Contains the details of the primary contact information associated with an Amazon Web Services account.
    ///   - logger: Logger use during operation
    @inlinable
    public func putContactInformation(
        accountId: String? = nil,
        contactInformation: ContactInformation,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = PutContactInformationRequest(
            accountId: accountId, 
            contactInformation: contactInformation
        )
        return try await self.putContactInformation(input, logger: logger)
    }

    /// Starts the process to update the primary email address for the specified account.
    @Sendable
    @inlinable
    public func startPrimaryEmailUpdate(_ input: StartPrimaryEmailUpdateRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StartPrimaryEmailUpdateResponse {
        try await self.client.execute(
            operation: "StartPrimaryEmailUpdate", 
            path: "/startPrimaryEmailUpdate", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Starts the process to update the primary email address for the specified account.
    ///
    /// Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
    ///   - primaryEmail: The new primary email address (also known as the root user email address) to use in the specified account.
    ///   - logger: Logger use during operation
    @inlinable
    public func startPrimaryEmailUpdate(
        accountId: String,
        primaryEmail: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartPrimaryEmailUpdateResponse {
        let input = StartPrimaryEmailUpdateRequest(
            accountId: accountId, 
            primaryEmail: primaryEmail
        )
        return try await self.startPrimaryEmailUpdate(input, logger: logger)
    }
}

extension Account {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: Account, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension Account {
    /// Return PaginatorSequence for operation ``listRegions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listRegionsPaginator(
        _ input: ListRegionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListRegionsRequest, ListRegionsResponse> {
        return .init(
            input: input,
            command: self.listRegions,
            inputKey: \ListRegionsRequest.nextToken,
            outputKey: \ListRegionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listRegions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - accountId: Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
    ///   - maxResults: The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a NextToken is provided in the command’s output. To resume pagination, provide the NextToken value in the starting-token argument of a subsequent command. Do not use the NextToken response element directly outside of the Amazon Web Services CLI. For usage examples, see Pagination in the Amazon Web Services Command Line Interface User Guide.
    ///   - regionOptStatusContains: A list of Region statuses (Enabling, Enabled, Disabling, Disabled, Enabled_by_default) to use to filter the list of Regions for a given account. For example, passing in a value of ENABLING will only return a list of Regions with a Region status of ENABLING.
    ///   - logger: Logger used for logging
    @inlinable
    public func listRegionsPaginator(
        accountId: String? = nil,
        maxResults: Int? = nil,
        regionOptStatusContains: [RegionOptStatus]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListRegionsRequest, ListRegionsResponse> {
        let input = ListRegionsRequest(
            accountId: accountId, 
            maxResults: maxResults, 
            regionOptStatusContains: regionOptStatusContains
        )
        return self.listRegionsPaginator(input, logger: logger)
    }
}

extension Account.ListRegionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Account.ListRegionsRequest {
        return .init(
            accountId: self.accountId,
            maxResults: self.maxResults,
            nextToken: token,
            regionOptStatusContains: self.regionOptStatusContains
        )
    }
}
